import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ApplicationVO, ApplicationForm, ApplicationQuery } from '@/api/system/application/types';

/**
 * 查询注册申请列表
 * @param query
 * @returns {*}
 */

export const listApplication = (query?: ApplicationQuery): AxiosPromise<ApplicationVO[]> => {
  return request({
    url: '/system/application/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询注册申请详细
 * @param id
 */
export const getApplication = (id: string | number): AxiosPromise<ApplicationVO> => {
  return request({
    url: '/system/application/' + id,
    method: 'get'
  });
};

/**
 * 新增注册申请
 * @param data
 */
export const addApplication = (data: ApplicationForm) => {
  return request({
    url: '/system/application',
    method: 'post',
    data: data
  });
};

/**
 * 修改注册申请
 * @param data
 */
export const updateApplication = (data: ApplicationForm) => {
  return request({
    url: '/system/application',
    method: 'put',
    data: data
  });
};

/**
 * 删除注册申请
 * @param id
 */
export const delApplication = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/application/' + id,
    method: 'delete'
  });
};
